package com.chen.controller;

import com.chen.service.CourseService;
import com.chen.vo.Result;
import com.chen.vo.param.CourseParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author:chenao
 * @DATE:2022/3/19 14:54
 */
@RestController
@RequestMapping("course")
public class CourseController {

    @Autowired
    private CourseService courseService;

    /**
     * 课程列表
     * @param param
     * @return
     */
    @PostMapping("list")
    public Result listCourse(@RequestBody CourseParam param){
        return courseService.listCourse(param);
    }

    /**
     * 课程详情
     * @param param
     * @return
     */
    @PostMapping("detail")
    public Result courseDetail(@RequestBody CourseParam param){
        return courseService.findCourseDetail(param);
    }

    /**
     * 预约课程，需要判断用户余额和类型
     * @param param
     * @return
     */
    @PostMapping("reserve")
    public Result reserveCourse(@RequestBody CourseParam param){
        return courseService.reserveCourse(param);
    }


}
